package com.ad_hccm.dao.Week;

import com.ad_hccm.domain.Week.RecrudescenceEvaluate;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Date;
import java.util.List;

/**
 * TODO 复发评定
 */
@Mapper
public interface RecrudescenceEvaluateDao {
    @Insert("insert into recrudescence_evaluate value(#{id}, #{date}, #{week}, #{finishFollow_up}, #{isRecrudescence}, #{finish})")
    public boolean save(RecrudescenceEvaluate domain);

    @Update("update recrudescence_evaluate set finishFollow_up = #{finishFollow_up}, isRecrudescence = #{isRecrudescence}, finish = #{finish} where id=#{id} and date = #{date}")
    public boolean update(RecrudescenceEvaluate domain);

    @Select("select * from recrudescence_evaluate where id=#{id}")
    public List<RecrudescenceEvaluate> getById(String id);

    @Select("select * from recrudescence_evaluate")
    public List<RecrudescenceEvaluate> getAll();

    @Select("select recrudescence_evaluate.id id, week, finishFollow_up, isRecrudescence, date, finish from recrudescence_evaluate,patient_user where patient_user.id=recrudescence_evaluate.id and patient_user.doctorId = #{id} and date >= #{date}")
    public List<RecrudescenceEvaluate> getBigDate(String id, Date date);
}